﻿@page
@model AdminUI.Pages.Home.TenantMainModel
@{
    var F = Html.F();
}
@section head {
    <link href="~/res/css/dashboard.css?v=1" rel="stylesheet" />
}

@section body {

    <f:Panel IsFluid="true" Layout="Block" BlockConfigSpace="20" BlockConfigBlockCount="12" ShowBorder="false" ShowHeader="false">
        <Items>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    @*<div class="title"><a href="#" onclick="top.addTabPageByHref('/Mall/Goods')">今日订单</a></div>*@
                    <div class="title">今日订单</div>
                    <div class="number">@ViewBag.NumOfDay</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">今日收入</div>
                    <div class="number">￥@ViewBag.AmountOfDay</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">本月订单</div>
                    <div class="number">@ViewBag.NumOfMonth</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">本月收入</div>
                    <div class="number">￥@ViewBag.AmountOfMonth</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">本月成本</div>
                    <div class="number">￥@ViewBag.CostOfMonth</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">本月分账</div>
                    <div class="number">￥@ViewBag.DividedAmountOfMonth</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">余额抵扣</div>
                    <div class="number">￥@ViewBag.DeductionAmountOfMonth</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">本月提现</div>
                    <div class="number">￥@ViewBag.CashApplyOfMonth</div>
                </div>
            </f:ContentPanel>


            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">会员总数</div>
                    <div class="number">@ViewBag.MemberTotal</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">@Model.OnlineMAName 会员数</div>
                    <div class="number">@ViewBag.MANum</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">@Model.OnlineMBName 会员数</div>
                    <div class="number">@ViewBag.MBNum</div>
                </div>
            </f:ContentPanel>
            <f:ContentPanel BlockMD="2" BlockLG="2" ShowBorder="false" ShowHeader="false">
                <div class="mycard">
                    <div class="title">@Model.OnlineMCName 会员数</div>
                    <div class="number">@ViewBag.MCNum</div>
                </div>
            </f:ContentPanel>
           
            
            <f:Panel BlockMD="12" BlockLG="6" Layout="Block" BlockConfigSpace="20" ShowBorder="false" ShowHeader="false">
                <Items>
                    <f:Grid ID="Grid1" CssClass="mygrid" BlockMD="12" Height="500" ShowBorder="true" ShowHeader="true" Title="最近订单列表" EnableRowLines="true" EnableColumnLines="true" DataIDField="OrderID" DataSource="@ViewBag.OrderList">
                        <Columns>
                            <f:RenderField HeaderText="订单ID" DataField="OrderID" FieldType="Int" QuickSortField="true" Width="150" TextAlign="Center" />
                            @* <f:RenderField HeaderText="租户" DataField="TID" FieldType="Int" Hidden="@Model.OnlineTID > 0" Width="60" TextAlign="Center" /> *@
                            <f:RenderField HeaderText="会员信息" DataField="UserID" FieldType="Int" Width="260" RendererFunction="renderMemberInfo" ExpandUnusedSpace="true" />
                            <f:RenderField HeaderText="用户类型" DataField="UserType" Width="100" Hidden="true" />
                            <f:RenderField HeaderText="用户姓名" DataField="TrueName" Width="100" Hidden="true" />
                            <f:RenderField HeaderText="手机号" DataField="Mobile" Width="100" Hidden="true" />
                            <f:RenderField HeaderText="数量" DataField="Total" FieldType="Int" Width="60" TextAlign="Right" />
                            <f:RenderField HeaderText="总金额" DataField="Amount" FieldType="Double" Width="80" TextAlign="Right" />
                           @*  <f:RenderField HeaderText="抵扣" DataField="DeductionAmount" FieldType="Double" Width="70" TextAlign="Right" />
                            <f:RenderField HeaderText="成本" DataField="Cost" FieldType="Double" Width="70" TextAlign="Right" />
                            <f:RenderField HeaderText="业绩" DataField="Commission" FieldType="Double" Width="90" TextAlign="Right" />
                            <f:RenderField HeaderText="直推" DataField="L1Fee" FieldType="Double" Width="90" TextAlign="Right" />
                            <f:RenderField HeaderText="间推" DataField="L2Fee" FieldType="Double" Width="90" TextAlign="Right" /> *@
                            <f:RenderField HeaderText="状态" DataField="Status" RendererFunction="renderOrderStatus" FieldType="Int" Width="80" TextAlign="Center" />
                            <f:RenderField HeaderText="创建时间" DataField="CreateTime" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd HH:mm" Width="140" TextAlign="Center" />
                        </Columns>
                    </f:Grid>
                </Items>
            </f:Panel>
            <f:Panel BlockMD="12" BlockLG="6" Layout="Block" BlockConfigSpace="20" ShowBorder="false" ShowHeader="false">
                <Items>
                        <f:Grid ID="Grid2" CssClass="mygrid" BlockMD="12" Height="500" ShowBorder="true" ShowHeader="true" Title="最新加入会员" EnableRowLines="true" EnableColumnLines="true" DataIDField="AccountID" DataSource="@ViewBag.MemberList">
                        <Columns>
                            <f:RenderField HeaderText="会员用户ID" DataField="UserID" FieldType="Int" QuickSortField="true" Width="120" TextAlign="Center" />
                            <f:RenderField HeaderText="登录手机号" DataField="Mobile" Width="120" TextAlign="Center" />
                            <f:RenderField HeaderText="姓名" DataField="TrueName" Width="90" />
                            @* <f:RenderField HeaderText="性别" DataField="Sex" Width="60" TextAlign="Center" /> *@
                            <f:RenderField HeaderText="类型" DataField="UserType" Width="60" TextAlign="Center" />
                            <f:RenderField HeaderText="推荐人" DataField="RecoID" FieldType="Int" Width="150" RendererFunction="renderReco" />
                            <f:RenderField HeaderText="推荐人姓名" DataField="RecoName" Width="100" Hidden="true" />
                            <f:RenderField HeaderText="推荐人ID2" DataField="RecoID2" FieldType="Int" Width="80" Hidden="true" />
                            <f:RenderField HeaderText="推荐人姓名2" DataField="RecoName2" Width="100" Hidden="true" />
                            @* <f:RenderField HeaderText="客户名称" DataField="CustomerName" Width="160" ExpandUnusedSpace="true" /> *@
                            <f:RenderField HeaderText="加入时间" DataField="RegTime" ExpandUnusedSpace="true" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd HH:mm:ss" MinWidth="150"  />
                        </Columns>
                    </f:Grid>
                </Items>
            </f:Panel>
            
            
        </Items>
    </f:Panel>

    <div class="f-widget-content" id="emptycontent"></div>

}


@section script {

    <script src="~/res/js/grid.js"></script>
    <script src="~/res/third-party/echarts/echarts.min.js"></script>
    <script src="~/res/js/dashboard_chart.js?v=1"></script>
    <script>

        function onTabstripToolClick(event) {
            parent.addTab && parent.addTab({
                id: 'dashboard_iframe_grid',
                iframeUrl: '@Url.Content("~/IFrame/GridIFrame")',
                title: '表格与编辑窗体',
                refreshWhenExist: true
            });
        }

        //会员信息
        function renderMemberInfo(value, params) {
            var member = value + "-" + params.rowData.values.UserType + "-" + params.rowData.values.TrueName + "-" + params.rowData.values.Mobile;
            var receiver = params.rowData.values.ReceiverName + "-" + params.rowData.values.ReceiverPhone + "-" + params.rowData.values.ReceivingAddress;

            // return F.formatString('<font size="2">{0},{1}</font>', member,receiver);
            return F.formatString('<font size="2">{0}</font>', member);
        }

        function renderReco(value, params) {
            var reco = "";
            if (value > 0) {
                // reco = params.rowData.values.RecoID + "-" + params.rowData.values.RecoName;
                reco = params.rowData.values.RecoName;

                var id2 = params.rowData.values.RecoID2;
                if (id2 > 0) {
                    // reco += "=>" + params.rowData.values.RecoID2 + "-" + params.rowData.values.RecoName2;
                    reco += "=>" + params.rowData.values.RecoName2;
                }
            }

            return reco;
        }

        // 添加标签页（通过href在树中查找）
        // href: 选项卡对应的网址
        // actived: 是否激活选项卡（默认为true）
        function addTabPageByHref(href, actived) {
            var mainTabStrip = F(PARAMS.mainTabStrip);
            var treeMenu = F(PARAMS.treeMenu);

            F.addMainTabByHref(mainTabStrip, treeMenu, href, actived);
        }

        F.ready(function () {

            //$('.mycard .infoicon').click(function () {
            //    var card1 = $(this).parents('.mycard');
            //    var card2 = card1.siblings('.mycard');
            //    // 翻转动画
            //    F.flip(card1, card2);
            //});


            // 本站统计
            var siteStats = [];
            function addToSiteStats(title, content) {
                siteStats.push('<li class="f-state-default"><div class="title">' + title + '</div><div class="content">' + content + '</div></li>');
            }
            var examplesCount = parent.getExamplesCount ? parent.getExamplesCount() : '---';
            var examplesCountTitle = '示例数';
            var cookieShowOnlyBase = F.cookie('ShowOnlyBase');
            if (cookieShowOnlyBase == 'true') {
                examplesCountTitle += '（仅基础版）';
            }
            addToSiteStats(examplesCountTitle, examplesCount);

            var cookieSearchText = F.cookie('SearchText');
            if (cookieSearchText) {
                addToSiteStats('搜索关键字', cookieSearchText);
            }

            addToSiteStats('显示模式', F.displayMode);
            addToSiteStats('语言', F.language);
            addToSiteStats('主题', F.theme);
            addToSiteStats('版本', F.version);
            $('.mysitestats').html(siteStats.join(''));

        });

    </script>

}